package ch6;

import java.util.*;

public class StringDel {

	public static void main(String[] args) {
		// 从数组中删除一个
		String ar[] = { "梦露", "乔碧罗", "罗玉凤", "菜虚困", "春哥", "老李" };
		int delIndx = 0;
		Scanner in = new Scanner(System.in);
		System.out.println("输入要删除的位置：");
		delIndx = in.nextInt();// 不越界
//		//  1:不移动
//		ar[delIndx] = null;
//		for (String s : ar)
//			System.out.println(s);
		// 2:移动
		for (int j = delIndx; j < ar.length - 1; j++) {
			ar[j] = ar[j + 1];
		}
		ar[ar.length - 1] = null;
		// if(ar[i]==null)
		for (String s : ar)
			System.out.println(s);
	}

}
